﻿@model GrandMan.Models.EditorModel
@{
    ViewBag.Title = "编辑器";
    Layout = null;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Scripts/ueditor/themes/default/ueditor.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/ueditor/editor_config.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/ueditor/editor_ui_all_min.js")" type="text/javascript"></script>
    <script src="http://code.jquery.com/jquery-1.7.min.js")" type="text/javascript"></script>
    <script type="text/javascript">
        var editor;
        $(document).ready(function () {

            $('#editor').hide();

            editor = new baidu.editor.ui.Editor({
                UEDITOR_HOME_URL: '../../Scripts/ueditor/',
                iframeCssUrl: '../../Scripts/ueditor/themes/default/iframe.css',
                autoClearinitialContent: true,
                initialContent: '<span style="color:#ccc">请输入内容</span>',
                elementPathEnabled: false,
                minFrameHeight:400
            });

            editor.render('editor');

            $('#editor').show();
        });
        function sumbit() {
            alert(editor.getContent());
            $(".content").attr("value", editor.getContent());

        }
    </script>
</head>
<body>
    @using (Html.BeginForm())
    { 
        <div>
            <div id='editor'></div>
        </div>
        @Html.HiddenFor(m => m.Content, new {@class="content" })
        <p class="submit">
            <input type="submit" value="确定" class="input-submit" onclick="sumbit()" />
        </p>
    }
</body>
</html>

